package com.sugree.jibjib;

import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.sugree.jibjib.data.JibJibDatabase;

public class MenuHelper {
	public static Intent getFriendIntent(Context context) {
		Intent intent;

		intent = new Intent(context, TweetListActivity.class);
		intent.setData(JibJibDatabase.Tweets.CONTENT_URI);
		intent.setAction(Intent.ACTION_MAIN);
		intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

		return intent;
	}

	public static Intent getMentionIntent(Context context, String username) {
		Intent intent;
		Bundle appDataBundle;

		intent = new Intent(context, TweetListActivity.class);
		if (username != null) {
			intent.putExtra(SearchManager.QUERY, "@" + username);
		}
		appDataBundle = new Bundle();
		appDataBundle.putParcelable("content_uri", JibJibDatabase.Tweets.SEARCH_URI);
		intent.putExtra(SearchManager.APP_DATA, appDataBundle);
		intent.setAction(Intent.ACTION_SEARCH);
		intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

		return intent;
	}

	public static Intent getMessageIntent(Context context) {
		Intent intent;
		Bundle appDataBundle;

		intent = new Intent(context, MessageListActivity.class);
		appDataBundle = new Bundle();
		appDataBundle.putParcelable("content_uri", JibJibDatabase.DirectMessages.SEARCH_URI);
		intent.putExtra(SearchManager.APP_DATA, appDataBundle);
		intent.setAction(Intent.ACTION_SEARCH);
		intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
		return intent;
	}
	public static void startFriendTimeline(Context context) {
		context.startActivity(getFriendIntent(context));
	}

	public static void startMentionTimeline(Context context, String username) {
		context.startActivity(getMentionIntent(context, username));
	}

	public static void startMessageTimeline(Context context) {
		context.startActivity(getMessageIntent(context));
	}

}
